package 排序;

import java.util.Arrays;

import 排序.tools.Asserts;
import 排序.tools.Integers;

@SuppressWarnings("all")
public class Main {
	public static void main(String[] args) {
		Integer[] array = Integers.random(20000, 1, 20000);
		Integer[] array1 = Integers.random(20, 1, 50);
		Integers.println(array1);
		new RadixSort().sort(array1);
		Integers.println(array1);
		testSort(array, 
				/*new BubbleSort(), 
				new SelectionSort(), 
				new InsertionSort(),
				new HeapSort(),
				new MergeSort(),
				new QuickSort(), 
				new ShellSort());*/
				new RadixSort(),
				new CountingSort());
	}	
	
	static void testSort(Integer[] array, Sort... sorts) {
		for (Sort sort : sorts) {
			Integer[] copy = Integers.copy(array);
			sort.sort(copy);
			Asserts.test(Integers.isAscOrder(copy));
		}
		Arrays.sort(sorts);
		for (Sort sort : sorts) {
			System.out.println(sort);
		}
	}
}
